package com.stone.business.cllyjl.action;

import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;

import com.stone.business.cllyjl.pojo.TCllyjl;
import com.stone.business.cllyjl.service.CllyjlService;
import com.stone.business.workcard.pojo.Gxzlkzk;
import com.stone.business.workcard.service.WorkcardService;
import com.stone.utils.StringUtils;

import frm.ssh.action.BaseListAction;

public class CllyjlListAction extends BaseListAction {

	private CllyjlService cllyjlService;
	@Override
	public HashMap<String, Object> setSearchCondition() {
		HashMap<String, Object> m = new HashMap<String, Object>();
		
		List<Object> valsList = new ArrayList<Object>();
		
		m.put("cols", " a ");
		
		String conditions = " 1=1 "; 
		String cxrq="";
		if(super.getSearchBean().getCon6().equals("1")){
			cxrq="a.startdate";
		}else{
			cxrq="a.rkdate";
		}
		if (!StringUtils.isNullOrBlankFull(super.getSearchBean().getCon2())) {
			conditions += " AND TO_CHAR("+cxrq+",'yyyy-MM-dd') >= ?";
			valsList.add(super.getSearchBean().getCon2());
		}
		
		if (!StringUtils.isNullOrBlankFull(super.getSearchBean().getCon3())) {
			conditions += " AND TO_CHAR("+cxrq+",'yyyy-MM-dd') <= ?";
			valsList.add(super.getSearchBean().getCon3());
		}
		
		if (!StringUtils.isNullOrBlankFull(super.getSearchBean().getCon4())) {
			conditions += " AND stationid = ?";
			valsList.add(super.getSearchBean().getCon4());
		}
		if (!StringUtils.isNullOrBlankFull(super.getSearchBean().getCon6())) {
			conditions += " AND dantype = ?";
			valsList.add(super.getSearchBean().getCon6());
		}
		// 查询条件
		m.put("conditions",conditions);
		m.put("alias", " a ");
		m.put("vals", valsList.toArray());
		String forword="";
		if(super.getSearchBean().getCon6().equals("2")){
			forword="RKD_SUCCESS";
			m.put("clause", " order by a.rkdate Desc");
		}else{
			forword="success";
			m.put("clause", " order by a.lydate Desc");
		}
		m.put("forward", forword);
		
		return m;
	}
	public CllyjlService getCllyjlService() {
		return cllyjlService;
	}
	public void setCllyjlService(CllyjlService cllyjlService) {
		this.cllyjlService = cllyjlService;
		this.service=cllyjlService;
	}
	public CllyjlListAction() {
		this.entityClass = TCllyjl.class;
	}
	

}
